package design_pattern.Singleton;

/**
 * @Author: 蔡翔
 * @Date: 2019/10/23 14:39
 * @Version 1.0
 */
public class SingletonObject3 {
    private static SingletonObject3 instance;
    private SingletonObject3(){

    }
    //用加锁的方式
    private synchronized static SingletonObject3 getInstance()
    {
        if(instance == null){
            instance = new SingletonObject3();
        }
        return instance;
    }
}
